package com.ease.framework.gef4p.commands {
   import com.ease.framework.gef.EditPart;
   import com.ease.framework.gef.IEditor;
   import com.ease.framework.gef4p.model.Annotation;
   import com.ease.framework.workbench.Workbench;
   import com.ease.framework.workbench.spi.impls.Command;

   public class EditAnnotationContentCommand extends Command {
      private var pmodel:Annotation;
      private var oldContent:String;
      private var newContent:String;

      public function EditAnnotationContentCommand(model:Annotation, content:String) {
         super();
         pmodel = model;
         oldContent = pmodel.content;
         newContent = content;
      }

      override public function execute():void {
         pmodel.content = newContent;
         var ep:EditPart = IEditor(Workbench.instance.currentEditor).getEditDomain().getEditPartByModel(pmodel) as EditPart;
         ep.refreashFigure();
      }

      override public function undo():void {
         pmodel.content = oldContent;
         var ep:EditPart = IEditor(Workbench.instance.currentEditor).getEditDomain().getEditPartByModel(pmodel) as EditPart;
         ep.refreashFigure();
      }

   }
}